package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppPlanAdjustmentMapper;
import com.ep.modules.app.entity.AppPlanAdjustment;
import com.ep.modules.app.entity.AppPlanAdjustmentExample;
import com.ep.modules.app.service.AppPlanAdjustmentService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppPlanAdjustmentServiceImpl implements AppPlanAdjustmentService {
    @Autowired
    private AppPlanAdjustmentMapper appPlanAdjustmentMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppPlanAdjustmentExample example = new AppPlanAdjustmentExample();
        AppPlanAdjustmentExample.Criteria criteria = example.createCriteria();
        List<AppPlanAdjustment> list = appPlanAdjustmentMapper.selectByExample(example);
        Page<AppPlanAdjustment> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppPlanAdjustment getById(Long id) {
        return appPlanAdjustmentMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppPlanAdjustment entity) {
        appPlanAdjustmentMapper.insert(entity);
    }

    public void update(AppPlanAdjustment entity) {
        appPlanAdjustmentMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appPlanAdjustmentMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}